﻿@model smartcrm.Models.UserListModel

<script src="../../Scripts/user.js"></script>

<div class="FR">
<input type="button" value="新增" id="btnNew" />
</div>
<div class="list">
<table id="tUser">
<thead>
<tr>
<th style="width:8%">登录账号</th>
<th style="width:8%">用户姓名</th>
<th style="width:12%">电话</th>
<th style="width:12%">手机</th>
<th style="width:12%">Email</th>
<th>备注</th>
<!-- <th style="width:12%">所属部门</th> -->
<th style="width:15%">操作</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Users)
        {
            <tr>
                <td>@Html.DisplayFor(modelItem => item.UserId)</td>
                <td>@Html.DisplayFor(modelItem => item.UserName)</td>
                <td>@Html.DisplayFor(modelItem => item.Phone)</td>      
                <td>@Html.DisplayFor(modelItem => item.Mobile)</td>                
                <td>@Html.DisplayFor(modelItem => item.Email)</td>   
                <td>@Html.DisplayFor(modelItem => item.Memo)</td>    
              <!--  <td>@Html.DisplayFor(modelItem => item.Department)</td> -->
                <td>
                    <img src="../../Images/grid/edit.png" title="编辑" onclick="javascript:EditUser('@item.UserId')" />
                    <img src="../../Images/grid/delete.png" title="删除"  onclick="javascript:DeleteUser('@item.UserId')" /> 
                    <img src="../../Images/grid/key.png" title="重置密码"  onclick="javascript:ResetPassword('@item.UserId','@item.UserName')" /> 
                  <!--  <img src="../../Images/grid/department.png" title="所属部门"  onclick="javascript:EditDepartment('@item.UserId')" /> -->
                   <img src="../../Images/grid/priviledge.png" title="权限管理"  onclick="javascript:EditPermission('@item.UserId')" />
                </td>
            </tr>
        }
</tbody>
</table>
</div>

<div id="divUser" title="用户信息" style="display:none">      
    <div id="divUserContent" style="overflow-y: auto; height: 300px;">          
        @using (Html.BeginForm())
        {
            <table class="font85 tableEdit">               
                <tr>
                    <td class="label">姓名</td>
                    <td>
                        @Html.TextBox("UserName", null, new { maxlength = "50" })&nbsp;<span class="redStar">*</span>                                           
                    </td>
                </tr>
                <tr>
                    <td class="label">座机</td>
                    <td>
                        @Html.TextBox("Phone", null, new { maxlength = "50" })                       
                     </td>
                </tr>   
                <tr>
                    <td class="label">手机</td>
                    <td>
                        @Html.TextBox("Mobile", null, new { maxlength = "50" })                       
                     </td>
                </tr>              
                <tr>
                    <td class="label">Email</td>
                    <td>
                        @Html.TextBox("Email", null, new { maxlength = "50" })
                     </td>
                </tr>  
                <tr>
                    <td class="label">备注</td>
                    <td>
                        @Html.TextArea("Memo", null, new { maxlength = "200" })
                     </td>
                </tr>                        
            </table> 
            <br />          
            @Html.Hidden("UserId")         
        }
    </div>  
    <div style="text-align:right;">  
       <span id="errorMessage" class="errorSpan"></span>   
       <input type="button" id="btnSave" value="保存" />
       <input type="button" id="btnCancel" value="取消" />    
    </div>  
</div>  


<div id="divDepartment" title="所属部门" style="display:none">      
    <div id="divUserContent" style="overflow-y: auto; height: 280px;">          
        @using (Html.BeginForm())
        {
            <table id="tableEdit" class="font85 tableEdit">
               <thead>
               <tr>
                    <td class="label">公司部门</td>
                    <td></td>
                    <td class="label">用户所属部门</td>                    
                </tr>
                </thead>
                <tr>
                    <td>
                        <select style="width:160px; height:200px;" id="adepartment"multiple="multiple" size="24"/>                        
                    </td>
                    <td  style="width:100px; text-align:center;">
                        <input type="button" value="添加-&gt;" id="btnAddDepartment" />
                        <br />
                        <input style="margin-top:2px" type="button" value="&lt;-移除" id="btnRemoveDepartment" />
                    </td>
                    <td>
                        <select style="width:160px; height:200px;" id="bdepartment"multiple="multiple" size="24"/>                        
                    </td>
                </tr>                   
            </table> 
            <br />                  
        }
    </div>  
    <div style="text-align:right;">  
       <span id="errorMessageDepartment" class="errorSpan"></span>      
       <input type="button" id="btnSaveDepartment" value="保存" />
       <input type="button" id="btnCancelDepartment" onclick="javascript:closeDepartment();" value="取消" />    
    </div>  
</div>  

<div id="divPermission" title="用户权限" style="display:none">      
    <div id="divPermissionContent" style="overflow-y: auto; height: 360px;">        
        @foreach (smartcrm.Models.RoleGroupModel rg in Model.RoleGroups)
        {
          <div style="clear:both; color:#666; height:22px; font-size:1.0em;font-weight:bold; padding-top:5px; padding-left:5px; margin-top:10px;">@rg.RoleGroupName</div>
            <div style="border:1px;overflow:hidden; border-color:Blue;border-bottom: 2.5px solid #1D6387;">
                @foreach (smartcrm.Models.PermissionModel p in rg.Permissions)
                {
                <div style="float:left; margin-right:10px; width:110px;">
                        <input type="checkbox" id="@p.PermissionNo" /> @p.PermissionName
                    </div>
                }
                </div> 
        }   
       
    </div>  
    <div style="text-align:right;">  
     <span id="errorMessagePermission" class="errorSpan"></span>  
       <input type="button" id="btnSavePermission" value="保存" />
       <input type="button" id="btnCancelPermission" onclick="javascript:closePermission();" value="取消" />    
    </div>  
</div>  


<div id="divPassword" title="重置密码" style="display:none">      
    <div id="divPasswordContent" style="overflow-y: auto; height: 60px;">          
       
    </div>  
    <div style="text-align:right;">      
        <input type="button" onclick="javascript:$('#divPassword').dialog('close');" value="关闭" />      
    </div>  
</div>  


